iT邦幫忙

0

從零打造輔大課表神器:Chrome Extension 開發實戰 30 天 - Day 29

  • 分享至 

  • xImage
  •  

Day 29:專案部署與發布

🎯 系列目標:用 30 天時間,從零開始打造一個專屬輔大學生的課表生成 Chrome 擴充功能

💻 作者:輔大智慧資安 412580084

📅 Day 29:專案部署與發布

🔗 課程系列回顧

經過前面 28 天的學習與實作,我們已經完成了一個功能完整的輔大課表生成 Chrome 擴充功能。今天我們將把這個專案打包並發布到 GitHub,讓大家可以使用和貢獻這個專案。

📦 專案打包

1. 整理專案檔案

首先,我們需要確保專案檔案結構完整且乾淨:

fju-schedule-extension/
├── background.js
├── content.js
├── manifest.json
├── popup.html
├── popup.js
├── schedule.html
├── schedule.js
├── schedule-styles.css
├── libs/
   └── html2canvas.min.js

2. 檢查 manifest.json 設定

確保 manifest.json 檔案中的版本號和資訊正確:

{
  "manifest_version": 3,
  "name": "輔大課表生成器",
  "version": "1.0",
  "description": "輔大課表生成器,一鍵產生當學期課表",
  "permissions": [
    "activeTab",
    "scripting",
    "storage",
    "downloads",
    "tabs"
  ],
  "host_permissions": [
    "https://portal.fju.edu.tw/*",
    "http://estu.fju.edu.tw/*"
  ],
  "web_accessible_resources": [
    {
      "resources": [
        "schedule.html", 
        "schedule-styles.css", 
        "schedule.js",
        "download.png",
        "libs/html2canvas.min.js"
      ],
      "matches": ["<all_urls>"]
    }
  ],
  "background": {
    "service_worker": "background.js"
  },
  "action": {
    "default_popup": "popup.html"
  },
  "content_scripts": [
    {
      "matches": [
        "https://portal.fju.edu.tw/*",
        "http://estu.fju.edu.tw/*"
      ],
      "js": ["content.js"]
    }
  ]
}

🚀 GitHub 發布步驟

1. 建立 GitHub 倉庫

  1. 登入 GitHub 帳號
  2. 點擊右上角的 "+" 號,選擇 "New repository"
  3. 輸入倉庫名稱,例如:FJU_Curriculum
  4. 選擇公開(Public)或私人(Private)
  5. 點擊 "Create repository"
    0

2. 上傳專案到 GitHub

  1. 在我們要的位置開啟 Git Bash 並加我們的剛剛建立的倉庫克隆下來
 git clone https://github.com/AlanTsai2004/FJU_Curriculum.git
  1. 將我們寫的專案文件複製到克隆倉庫資料夾下並開啟 Git Bash
    1

  2. 初始化 git

git init
  1. 將所有文件添加上去準備上傳
git add .
  1. 接著輸入文件上傳的描述
git commit -m "輔大課表生成器 v1.0"
  1. 選擇我們之前建立的倉庫
git remote set-url origin https://github.com/AlanTsai2004/FJU_Curriculum.git
  1. 最後將文件上傳到我們倉庫所要的分支
git push -u origin main

然後重新整理後我們會看到倉庫成功上傳了
5


🎯 明日預告

明天是我們自學系列的最後一天,我們將進行自學總結與未來展望,並將專案分享讓大家下載使用


圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言